﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FlatRedBall;
using FlatRedBall.Math.Geometry;
using FlatRedBall.Graphics;

namespace Runaway.Screens
{
    class TitleScreen : Screen
    {
        private double startTime;
        private Sprite title;

        public TitleScreen()
            : base("TitleScreen")
        {

        }
        public override void Initialize(bool addToManager)
        {
            startTime = TimeManager.CurrentTime;
            title = SpriteManager.AddSprite("Content/Prototype/titlescreen.png");
            float pixelsPerUnit = SpriteManager.Camera.PixelsPerUnitAt(title.Z);
            title.ScaleX = .5f * title.Texture.Width / pixelsPerUnit;
            title.ScaleY = .5f * title.Texture.Height / pixelsPerUnit;

            base.Initialize(addToManager);

            if (addToManager)
            {
                AddToManagers();
            }
        }
          public override void AddToManagers()
        {
            base.AddToManagers();
        }

        public override void Activity(bool firstTimeCalled)
        {
            if ((TimeManager.CurrentTime - startTime > 4) == true)
            {
                base.Destroy();
            }

            if (Input.getEnterInput() == true)
            {

                /*remove title screen upon pressing enter*/
                SpriteManager.RemoveSprite(title);
                MoveToScreen(typeof(GameScreen).FullName);
                base.Destroy();
            }
            

        }

        public override void Destroy()
        {
            SpriteManager.RemoveSprite(title);
            base.Destroy();
        }
    }
}
